home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Presentations
/
Presentations ’93
/
Voice Toolkit
/
Voice Slot
< prev
next >
Wrap
Lisp/Scheme
|
1993-04-24
|
3KB
|
89 lines
(in-package "VOICE-TOOLKIT")
(defclass voice-slot ()
((contents :accessor contents
:initarg :contents)
(owner :accessor owner
:initarg :owner)
(text :accessor appear
:initarg :text)
(careful :accessor careful
:initarg :careful
:initform t)
(text-color :accessor text-color)
(text-font :accessor text-font)))
(defmethod identify ((self voice-slot))
(file-voice-item self))
(defmethod exclusive ((self voice-slot))
(exclusive (owner self)))
(defmethod text ((self voice-slot))
(if (consp (appear self))
(format nil "~a ~{~a ~}"
(dialog-item-text (owner self))
(appear self))
(format nil "~a ~a"
(dialog-item-text (owner self))
(appear self))))
(defmethod print-object ((self voice-slot) stream)
(format stream "~a" (appear self)))
(defmethod select ((self voice-slot))
(mark-item (owner self) (find-slot (owner self) self))
(if (dialog-item-action (owner self))
(funcall (dialog-item-action (owner self)))))
(defmethod mark ((self voice-slot))
(if (numberp *mark-method*)
(progn
(setf (text-color self)
(part-color (owner self)
(make-point 0 (find-slot (owner self) self))))
(set-part-color (owner self)
(make-point 0 (find-slot (owner self) self))
*mark-method*))
(progn
(setf (text-font self)
(cell-font (owner self)
(make-point 0 (find-slot (owner self) self))))
(set-cell-font (owner self)
(make-point 0 (find-slot (owner self) self))
(list (first (view-font (owner self))) *mark-method*))))
(scroll-to-cell (owner self) (make-point 0 (find-slot (owner self) self)))
(view-draw-contents (owner self)))
(defmethod unmark ((self voice-slot))
(if (numberp *mark-method*)
(set-part-color (owner self)
(make-point 0 (find-slot (owner self) self))
(text-color self))
(set-cell-font (owner self)
(make-point 0 (find-slot (owner self) self))
(text-font self)))
(view-draw-contents (owner self)))
(defun in-slot (item slot)
(equal item (contents slot)))
(defun existing-slots (slots items)
(if slots
(if (member (contents (first slots)) items)
(cons (first slots) (existing-slots (rest slots) items))
(existing-slots (rest slots) items))))
(defun contents-of (item)
(if (equal (type-of item) 'voice-slot)
(contents item)
item))
(defun slot-values (slist)
(mapcar #'(lambda (s-item)
(if (equal (type-of s-item) 'voice-slot)
(contents s-item)))
slist))